<template>
  <div class="power_order">
    <div class="mask" @click="cancel" v-show="isshow"></div>
    <div class="head">
      <div class="h-head">
        <div class="left">
          <img src="../../assets/hy.png" alt />
          <p style="font-size:.48rem;color:#8A8A8A">LK</p>
        </div>
        <div class="right">
          <div
            style="margin-left:1.4rem;margin-right:1.093333rem"
            :class="{action:isaction}"
            @click="tab1"
            @click.prevent="active = 'tab-container1'"
          >云算力订单</div>
          <div
            style="font-weight: bold!important;"
            :class="{action:!isaction}"
            @click="tab2"
            @click.prevent="active = 'tab-container2'"
          >矿机订单</div>
        </div>
        <div class="wsd">
          <img src="@/assets/hdd.png" class="dian" @click="showLj" alt />
          <transition name="fade">
            <div class="s_list" v-show="isshow">
              <div class="s_block">
                <img class="xt" src="@/assets/zz.png" alt />
                <router-link to="/transfer">转账</router-link>
              </div>
              <div style="width:80px;background:#fff;height:1px"></div>
              <div class="s_block" @click="logout">
                <img class="xt" src="@/assets/logout.png" alt />
                <span>退出</span>
              </div>
            </div>
          </transition>
        </div>
      </div>
    </div>
    <div class="page-tab-container">
      <mt-tab-container class="page-tabbar-tab-container" v-model="active" swipeable>
        <mt-tab-container-item id="tab-container1">
          <div class="p_list">
            <div class="p_block">
              <div class="ll1">
                <p class="left">
                  <span class="yx1" style>永续</span>
                  <span class="yx2 g_color">订单号：2312312313</span>
                </p>
                <p class="right">
                  <span class="g_color">未支付</span>
                  <img src="../../assets/g_jt.png" alt />
                </p>
              </div>
              <div class="ll2">
                <span style="text-align:left">1T</span>
                <span>¥0.38</span>
                <span style="text-align:right">6.00%</span>
              </div>
              <div class="ll3">
                <span class="g_color" style="text-align:left;">数量</span>
                <span class="g_color">电费/度</span>
                <span class="g_color" style="text-align:right;">管理费</span>
              </div>
              <div class="b_order">
                <p style>
                  <span style="margin-right:.2rem;font-size:.48rem" class="f_weight">33.53</span>
                  <span style="font-size:.48rem;" class="f_weight">USDT</span>
                </p>
                <div class="b_btn" @click="$router.push('/order_detail')">去支付</div>
              </div>
            </div>
          </div>
        </mt-tab-container-item>
        <mt-tab-container-item id="tab-container2">
          <img class="wsj_t" src="@/assets/wsj.png" alt />
          <p class="zwsj">暂无数据</p>
        </mt-tab-container-item>
      </mt-tab-container>
    </div>
    <div style="height:1.333333rem"></div>
    <Tabbar :idx="2" />
  </div>
</template>

<script>
// @ is an alias to /src
import Tabbar from "@/views/Tabbar.vue";

export default {
  name: "power_order",
  components: {
    Tabbar
  },
  data() {
    return {
      active: "tab-container1",
      isaction: true,
      isshow: false
    };
  },

  created: function() {},
  mounted() {},
  watch: {
    active: function(newValue) {
      // active即为mt-tab-container的参数，这里监听它的改变并可以做相关操作：
      // 在你的tabBar组件点击的时候更改active的值
      // 滑动mt-tab-container-item组件即更改active的值，监听newValue的变化并操作你的tabBar，使得点击切换和滑动切换相关联
      console.log(this.active);
      if (this.active == "tab-container2") {
        this.isaction = false;
      } else {
        this.isaction = true;
      }
    }
  },
  methods: {
    tab1() {
      this.isaction = true;
    },
    tab2() {
      this.isaction = false;
    },
    showLj() {
      var aa = document.querySelector(".mint-tab-container");
      aa.style.position = "static";
      this.isshow = !this.isshow;
    },
    cancel() {
      this.isshow = false;
      var aa = document.querySelector(".mint-tab-container");
      aa.style.position = "relative";
    },
    logout() {
      this.$router.push("/");
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
.f-flex {
  display: flex;
  display: -webkit-flex;
  align-items: center;
}
.wsd {
  font-size: 0.48rem;
  position: absolute;
  right: 0.613333rem;
}
.wsj_t {
  width: 5rem;
  height: auto;
  margin-top: 1.066667rem;
}
.mask {
  background-color: transparent;
  opacity: 0.4;
  position: fixed;
  width: 100%;
  height: 100%;
}
.dian {
  width: 0.573333rem;
  height: auto;
}
.s_list {
  position: absolute;
  left: 0.2rem;
  width: 2.9rem;
  z-index: 999999;
  border-radius: 0.166667rem;
  background: #000;
  color: #fff;
  font-size: 0.4rem;
  transform: translateX(-80%);
  .f-flex();
  flex-direction: column;
  top: 0.84rem;
  .s_block {
    padding-top: 0.32rem;
    padding-bottom: 0.32rem;
    .f-flex();
  }
}
.s_list:after {
  content: "";
  position: absolute;
  bottom: 100%;
  right: 8px;
  width: 0;
  height: 0;
  border-width: 10px;
  border-style: solid;
  border-color: transparent;
  margin-bottom: -8px;
  border-bottom-width: 15px;
  border-bottom-color: currentColor;
  color: #000;
}
.xt {
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.2rem;
}
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.8s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  opacity: 0;
}
.action {
  position: relative;
  &:after {
    content: "";
    display: block;
    width: 0.586667rem;
    border-bottom: 0.066667rem solid #2942be;
    position: absolute;
    top: 0.7rem;
    left: 50%;
    transform: translateX(-50%);
  }
  color: #2942be;
  font-weight: bold !important;
}
.zwsj {
  font-size: 0.48rem;
  color: #d5d5d5;
}
.power_order {
  .head {
    color: #fefeff;
    padding-top: .32rem;
    padding-bottom: .32rem;
    width: 100%;
    background: #fff;
    box-shadow: 0px 2px 1px 0px rgba(36, 36, 36, 0.26);
    opacity: 0.96;
    .f-flex();
  }
  .h-head {
    color: #fefeff;
    margin-left: 0.346667rem;
    width: 100%;
    .f-flex();
    .left {
      .f-flex();
      font-size: 0.64rem;
      img {
        width: 0.226667rem;
        height: 0.373333rem;
        margin-right: 0.226667rem;
      }
    }
    .right {
      .f-flex();
      font-size: 0.4rem;
      color: #000;
      font-weight: bold !important;
      .active {
        position: relative;
        &:after {
          content: "";
          display: block;
          width: 0.586667rem;
          height: 0.066667rem;
          border-bottom: 0.08rem solid #2942be;
          border-radius: 1px;
          position: absolute;
          top: 0.8rem;
          left: 50%;
          margin-left: -0.64rem;
        }
        color: #2942be;
        font-weight: bold;
      }
    }
  }
  .p_block {
    width: 92%;
    margin: auto;
    margin-top: 0.266667rem;
    border-radius: 0.266667rem;
    background: #fff;
    padding-top: 0.266667rem;
    .ll1 {
      padding-left: 0.266667rem;
      padding-right: 0.266667rem;
      .f-flex();
      justify-content: space-between;
      .yx1 {
        font-size: 0.48rem;
        font-weight: bold !important;
        margin-right: 0.213333rem;
      }
      .yx2 {
        font-size: 0.32rem;
      }
      .right {
        .f-flex();
        span {
          padding-right: 0.146667rem;
        }
        img {
          width: 0.173333rem;
          height: 0.28rem;
        }
      }
    }
    .ll2 {
      .f-flex();
      margin: 0.266667rem auto;
      padding-left: 0.266667rem;
      padding-right: 0.266667rem;
      justify-content: space-between;
      color: #434343;
      span {
        width: 33.3%;
        font-weight: bold !important;
      }
    }
    .ll3 {
      .f-flex();
      padding-left: 0.266667rem;
      padding-right: 0.266667rem;
      justify-content: space-between;
      color: #474747;
      padding-bottom: 0.266667rem;
      span {
        width: 33.3%;
      }
    }
    .b_order {
      .f-flex();
      padding-left: 0.266667rem;
      padding-right: 0.266667rem;
      height: 1.333333rem;
      justify-content: space-between;
      color: #474747;
      border-top: 1px solid #f3eded;
    }
    .b_btn {
      background: #546ce3;
      width: 1.933333rem;
      height: 0.633333rem;
      text-align: center;
      font-size: 0.32rem;
      line-height: 0.633333rem;
      color: #fff;
      border-radius: 0.366667rem;
    }
  }
}
</style>

